//
//  ChangePasswordController.swift
//  ExpressDriver
//
//  Created by sheng on 2017/11/14.
//  Copyright © 2017年 sheng. All rights reserved.
//

import UIKit

class ChangePasswordController: UIViewController {
    
    var oldPasswordEdt: UITextField!
    
    var newPasswordEdt: UITextField!
    
    var confirmPasswordEdt: UITextField!
    
    var confirmBtn: UIButton!
    

    override func viewDidLoad() {
        super.viewDidLoad()
        self.view.backgroundColor = UIColor.white
        setUI()
    }
    
    
    
    func setUI()  {
        
        let imgLock1 =  UIImageView(frame:CGRect(x: 9, y: 9, width: 22, height: 22))
        imgLock1.image = UIImage(named:"password")
        
        let imgLock2 =  UIImageView(frame:CGRect(x: 9, y: 9, width: 22, height: 22))
        imgLock2.image = UIImage(named:"password")
        
        let imgLock3 =  UIImageView(frame:CGRect(x: 9, y: 9, width: 22, height: 22))
        imgLock3.image = UIImage(named:"password")
        
        oldPasswordEdt = UITextField()
        oldPasswordEdt.leftView = UIView(frame:CGRect(x: 0, y: 0, width: 40, height: 40))
        oldPasswordEdt.leftViewMode = UITextFieldViewMode.always
        oldPasswordEdt.leftView!.addSubview(imgLock1)
        oldPasswordEdt.placeholder = "old password"
        oldPasswordEdt.isSecureTextEntry = true
        oldPasswordEdt.font = UIFont.systemFont(ofSize: 14)
        oldPasswordEdt?.layer.borderColor = UIColor.gray.cgColor
        oldPasswordEdt?.layer.borderWidth = 0.5
        oldPasswordEdt?.layer.cornerRadius = 5
        self.view.addSubview(oldPasswordEdt)
        
        oldPasswordEdt.snp.makeConstraints { (make) in
            make.top.equalTo(self.view.snp.top).offset(84)
            make.left.equalTo(30)
            make.right.equalTo(-30)
            make.height.equalTo(40)
        }
        
        
        newPasswordEdt = UITextField()
        newPasswordEdt.leftView = UIView(frame:CGRect(x: 0, y: 0, width: 40, height: 40))
        newPasswordEdt.leftViewMode = UITextFieldViewMode.always
        newPasswordEdt.leftView!.addSubview(imgLock2)
        newPasswordEdt.placeholder = "new password"
        newPasswordEdt.isSecureTextEntry = true
        newPasswordEdt.font = UIFont.systemFont(ofSize: 14)
        newPasswordEdt?.layer.borderColor = UIColor.gray.cgColor
        newPasswordEdt?.layer.borderWidth = 0.5
        newPasswordEdt?.layer.cornerRadius = 5
        self.view.addSubview(newPasswordEdt)
        
        newPasswordEdt.snp.makeConstraints { (make) in
            make.top.equalTo(oldPasswordEdt.snp.bottom).offset(15)
            make.left.equalTo(30)
            make.right.equalTo(-30)
            make.height.equalTo(40)
        }
        
        
        confirmPasswordEdt = UITextField()
        confirmPasswordEdt.leftView = UIView(frame:CGRect(x: 0, y: 0, width: 40, height: 40))
        confirmPasswordEdt.leftViewMode = UITextFieldViewMode.always
        confirmPasswordEdt.leftView!.addSubview(imgLock3)
        confirmPasswordEdt.placeholder = "confirm password"
        confirmPasswordEdt.isSecureTextEntry = true
        confirmPasswordEdt.font = UIFont.systemFont(ofSize: 14)
        confirmPasswordEdt?.layer.borderColor = UIColor.gray.cgColor
        confirmPasswordEdt?.layer.borderWidth = 0.5
        confirmPasswordEdt?.layer.cornerRadius = 5
        self.view.addSubview(confirmPasswordEdt)
        
        confirmPasswordEdt.snp.makeConstraints { (make) in
            make.top.equalTo(newPasswordEdt.snp.bottom).offset(15)
            make.left.equalTo(30)
            make.right.equalTo(-30)
            make.height.equalTo(40)
        }
        
        
        confirmBtn = UIButton()
        confirmBtn.titleLabel?.font = UIFont.systemFont(ofSize: 16)
        confirmBtn.setTitle("Submit", for: UIControlState())
        confirmBtn.setTitleColor(UIColor.black, for: UIControlState())
        confirmBtn?.layer.borderColor = UIColor.gray.cgColor
        confirmBtn?.layer.borderWidth = 0.5
        confirmBtn?.layer.cornerRadius = 20
        self.view.addSubview(confirmBtn)
        confirmBtn.snp.makeConstraints { (make) in
            make.top.equalTo(confirmPasswordEdt.snp.bottom).offset(15)
            make.height.equalTo(45)
            make.width.equalTo(250)
            make.centerX.equalTo(self.view.snp.centerX)
        }

        
        
    }
    

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    

    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
